from wcs.libs.items import items
from wcs.libs.players import players

itemName = "Claws of Attack"
item = items.addItem(itemName)
item.setGroup("attack")
item.setCost(3500)
item.setDescription("Gain bonus damage on all attacks")
item.setMaxCount(1)
item.aliveToUse = True
        
def player_hurt(event_var):
    """
    Executed when the player is damaged, add an additional 6% of damage to the 
    attack.
    """
    if event_var["dmg_health"]:
        bonusDamage = int(event_var['dmg_health']) * 0.06
    elif event_var["damage"]:
        bonusDamage = int(event_var["damage"]) * 0.06
    else:
        bonusDamage = 6
    if event_var["es_userteam"] != event_var["es_attackerteam"]:
        if not event_var["attacker"] or int(event_var["attacker"]) == 0:
            return
        player = players[event_var["userid"]]
        player.damage(bonusDamage, 32, event_var['attacker'])
